<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module mpyc.gfpx</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="mpyc.html"><font color="#ffffff">mpyc</font></a>.gfpx</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="https://github.com/lschoe/mpyc/blob/v0.6/mpyc/gfpx.py">github.com/lschoe/mpyc/blob/v0.6/mpyc/gfpx.py</a></font></td></tr></table>
    <p><tt>This&nbsp;module&nbsp;supports&nbsp;arithmetic&nbsp;with&nbsp;polynomials&nbsp;over&nbsp;GF(p).<br>
&nbsp;<br>
Polynomials&nbsp;over&nbsp;GF(p)&nbsp;are&nbsp;represented&nbsp;as&nbsp;coefficient&nbsp;lists.<br>
The&nbsp;polynomial&nbsp;a_0&nbsp;+&nbsp;a_1&nbsp;X&nbsp;+&nbsp;...&nbsp;+&nbsp;a_n&nbsp;X^n&nbsp;corresponds<br>
to&nbsp;the&nbsp;list&nbsp;[a_0,&nbsp;a_1,&nbsp;...&nbsp;,&nbsp;a_n]&nbsp;of&nbsp;integers&nbsp;in&nbsp;{0,&nbsp;...&nbsp;,&nbsp;p-1}.<br>
Leading&nbsp;coefficient&nbsp;a_n&nbsp;is&nbsp;nonzero,&nbsp;using&nbsp;[]&nbsp;for&nbsp;the&nbsp;zero&nbsp;polynomial.<br>
&nbsp;<br>
However,&nbsp;binary&nbsp;polynomials&nbsp;(over&nbsp;GF(2))&nbsp;are&nbsp;represented&nbsp;as&nbsp;integers.<br>
The&nbsp;polynomial&nbsp;a_0&nbsp;+&nbsp;a_1&nbsp;X&nbsp;+&nbsp;...&nbsp;+&nbsp;a_n&nbsp;X^n&nbsp;corresponds<br>
to&nbsp;the&nbsp;integer&nbsp;a_0&nbsp;+&nbsp;a_1&nbsp;2&nbsp;+&nbsp;...&nbsp;+&nbsp;a_n&nbsp;2^n.<br>
Leading&nbsp;coefficient&nbsp;a_n&nbsp;is&nbsp;1,&nbsp;using&nbsp;0&nbsp;for&nbsp;the&nbsp;zero&nbsp;polynomial.<br>
&nbsp;<br>
The&nbsp;operators&nbsp;+,&nbsp;-,&nbsp;*,&nbsp;&lt;&lt;,&nbsp;//,&nbsp;%,&nbsp;and&nbsp;function&nbsp;divmod&nbsp;are&nbsp;overloaded.<br>
The&nbsp;operators&nbsp;&lt;,&nbsp;&lt;=,&nbsp;&gt;,&nbsp;&gt;=,&nbsp;==,&nbsp;!=&nbsp;are&nbsp;overloaded&nbsp;as&nbsp;well,&nbsp;using&nbsp;the<br>
lexicographic&nbsp;order&nbsp;for&nbsp;polynomials&nbsp;(zero&nbsp;polynomial&nbsp;is&nbsp;the&nbsp;smallest).<br>
&nbsp;<br>
GCD,&nbsp;extended&nbsp;GCD,&nbsp;modular&nbsp;inverse&nbsp;and&nbsp;powers&nbsp;are&nbsp;all&nbsp;supported.<br>
A&nbsp;simple&nbsp;irreducibility&nbsp;test&nbsp;is&nbsp;provided&nbsp;as&nbsp;well&nbsp;as&nbsp;a&nbsp;basic<br>
routine&nbsp;to&nbsp;find&nbsp;the&nbsp;next&nbsp;largest&nbsp;irreducible&nbsp;polynomial.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="https://docs.python.org/3/library/functools.html">functools</a><br>
</td><td width="25%" valign=top><a href="mpyc.gmpy.html">mpyc.gmpy</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="https://docs.python.org/3/library/functions.html#object>builtins.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="mpyc.gfpx.html#Polynomial">Polynomial</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="mpyc.gfpx.html#BinaryPolynomial">BinaryPolynomial</a>
</font></dt></dl>
</dd>
</dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="BinaryPolynomial">class <strong>BinaryPolynomial</strong></a>(<a href="mpyc.gfpx.html#Polynomial">Polynomial</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="#BinaryPolynomial">BinaryPolynomial</a>(value)<br>
&nbsp;<br>
Polynomials&nbsp;over&nbsp;GF(2)&nbsp;represented&nbsp;as&nbsp;nonnegative&nbsp;integers.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="mpyc.gfpx.html#BinaryPolynomial">BinaryPolynomial</a></dd>
<dd><a href="mpyc.gfpx.html#Polynomial">Polynomial</a></dd>
<dd><a href="https://docs.python.org/3/library/functions.html#object">builtins.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="BinaryPolynomial-__int__"><strong>__int__</strong></a>(self)</dt></dl>

<dl><dt><a name="BinaryPolynomial-to_bytes"><strong>to_bytes</strong></a>(self, length, byteorder)</dt><dd><tt>Return&nbsp;a&nbsp;bytes&nbsp;<a href="https://docs.python.org/3/library/functions.html#object">object</a>&nbsp;representing&nbsp;a&nbsp;polynomial.</tt></dd></dl>

<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>p</strong> = 2</dl>

<hr>
Methods inherited from <a href="mpyc.gfpx.html#Polynomial">Polynomial</a>:<br>
<dl><dt><a name="BinaryPolynomial-__add__"><strong>__add__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__bool__"><strong>__bool__</strong></a>(self)</dt><dd><tt>Truth&nbsp;value&nbsp;testing.<br>
&nbsp;<br>
Return&nbsp;False&nbsp;if&nbsp;this&nbsp;polynomial&nbsp;is&nbsp;zero,&nbsp;True&nbsp;otherwise.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-__divmod__"><strong>__divmod__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__eq__"><strong>__eq__</strong></a>(self, other)</dt><dd><tt>Equality&nbsp;test.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-__floordiv__"><strong>__floordiv__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__ge__"><strong>__ge__</strong></a>(self, other)</dt><dd><tt>Greater-than&nbsp;or&nbsp;equal&nbsp;comparison.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-__gt__"><strong>__gt__</strong></a>(self, other)</dt><dd><tt>Strictly&nbsp;greater-than&nbsp;comparison.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-__hash__"><strong>__hash__</strong></a>(self)</dt><dd><tt>Make&nbsp;polynomials&nbsp;hashable&nbsp;(e.g.,&nbsp;for&nbsp;LRU&nbsp;caching).</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-__iadd__"><strong>__iadd__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__ifloordiv__"><strong>__ifloordiv__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__ilshift__"><strong>__ilshift__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__imod__"><strong>__imod__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__imul__"><strong>__imul__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__init__"><strong>__init__</strong></a>(self, value)</dt><dd><tt>Initialize&nbsp;self.&nbsp;&nbsp;See&nbsp;help(type(self))&nbsp;for&nbsp;accurate&nbsp;signature.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-__irshift__"><strong>__irshift__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__isub__"><strong>__isub__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__le__"><strong>__le__</strong></a>(self, other)</dt><dd><tt>Less-than&nbsp;or&nbsp;equal&nbsp;comparison.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-__lshift__"><strong>__lshift__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__lt__"><strong>__lt__</strong></a>(self, other)</dt><dd><tt>Strictly&nbsp;less-than&nbsp;comparison.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-__mod__"><strong>__mod__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__mul__"><strong>__mul__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__ne__"><strong>__ne__</strong></a>(self, other)</dt><dd><tt>Negated&nbsp;equality&nbsp;test.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-__neg__"><strong>__neg__</strong></a>(self)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__pos__"><strong>__pos__</strong></a>(self)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__pow__"><strong>__pow__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__radd__"><strong>__radd__</strong></a> = <a href="#BinaryPolynomial-__add__">__add__</a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__rdivmod__"><strong>__rdivmod__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return&nbsp;repr(self).</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-__rfloordiv__"><strong>__rfloordiv__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__rlshift__"><strong>__rlshift__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__rmod__"><strong>__rmod__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__rmul__"><strong>__rmul__</strong></a> = <a href="#BinaryPolynomial-__mul__">__mul__</a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__rrshift__"><strong>__rrshift__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__rshift__"><strong>__rshift__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__rsub__"><strong>__rsub__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-__sub__"><strong>__sub__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="BinaryPolynomial-degree"><strong>degree</strong></a>(self)</dt><dd><tt>Degree&nbsp;of&nbsp;polynomial&nbsp;(-1&nbsp;for&nbsp;zero&nbsp;polynomial).</tt></dd></dl>

<hr>
Class methods inherited from <a href="mpyc.gfpx.html#Polynomial">Polynomial</a>:<br>
<dl><dt><a name="BinaryPolynomial-add"><strong>add</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Add&nbsp;polynomials&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-deg"><strong>deg</strong></a>(a)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Degree&nbsp;of&nbsp;polynomial&nbsp;a&nbsp;(-1&nbsp;if&nbsp;a&nbsp;is&nbsp;zero&nbsp;polynomial).</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-divmod"><strong>divmod</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Divide&nbsp;polynomial&nbsp;a&nbsp;by&nbsp;polynomial&nbsp;b&nbsp;with&nbsp;remainder,&nbsp;for&nbsp;nonzero&nbsp;b.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-from_terms"><strong>from_terms</strong></a>(s, x='x')<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Convert&nbsp;string&nbsp;s&nbsp;with&nbsp;sum&nbsp;of&nbsp;powers&nbsp;of&nbsp;x&nbsp;to&nbsp;a&nbsp;polynomial.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-gcd"><strong>gcd</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Greatest&nbsp;common&nbsp;divisor&nbsp;of&nbsp;polynomials&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-gcdext"><strong>gcdext</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Extended&nbsp;GCD&nbsp;for&nbsp;polynomials&nbsp;a&nbsp;and&nbsp;b.<br>
&nbsp;<br>
Return&nbsp;d,&nbsp;s,&nbsp;t&nbsp;satisfying&nbsp;s&nbsp;a&nbsp;+&nbsp;t&nbsp;b&nbsp;=&nbsp;d&nbsp;=&nbsp;<a href="#BinaryPolynomial-gcd">gcd</a>(a,b).</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-invert"><strong>invert</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Inverse&nbsp;of&nbsp;polynomial&nbsp;a&nbsp;modulo&nbsp;polynomial&nbsp;b,&nbsp;for&nbsp;nonzero&nbsp;b.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-is_irreducible"><strong>is_irreducible</strong></a>(a)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Test&nbsp;polynomial&nbsp;a&nbsp;for&nbsp;irreducibility.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-lshift"><strong>lshift</strong></a>(a, n)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Multiply&nbsp;polynomial&nbsp;a&nbsp;by&nbsp;X^n.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-mod"><strong>mod</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Reduce&nbsp;polynomial&nbsp;a&nbsp;modulo&nbsp;polynomial&nbsp;b,&nbsp;for&nbsp;nonzero&nbsp;b.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-mul"><strong>mul</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Multiply&nbsp;polynomials&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-next_irreducible"><strong>next_irreducible</strong></a>(a)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Return&nbsp;lexicographically&nbsp;next&nbsp;monic&nbsp;irreducible&nbsp;polynomial&nbsp;&gt;&nbsp;a.<br>
&nbsp;<br>
E.g.,&nbsp;X&nbsp;&lt;&nbsp;X+1&nbsp;&lt;&nbsp;X^2+X+1&nbsp;&lt;&nbsp;X^3+X+1&nbsp;&lt;&nbsp;X^3+X^2+1&nbsp;&lt;&nbsp;...&nbsp;for&nbsp;p=2.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-powmod"><strong>powmod</strong></a>(a, n, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt><a href="#Polynomial">Polynomial</a>&nbsp;a&nbsp;to&nbsp;the&nbsp;power&nbsp;of&nbsp;n&nbsp;modulo&nbsp;polynomial&nbsp;b,&nbsp;for&nbsp;nonzero&nbsp;b.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-rshift"><strong>rshift</strong></a>(a, n)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Quotient&nbsp;for&nbsp;polynomial&nbsp;a&nbsp;divided&nbsp;by&nbsp;X^n,&nbsp;assuming&nbsp;a&nbsp;is&nbsp;multiple&nbsp;of&nbsp;X^n.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-sub"><strong>sub</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Subtract&nbsp;polynomials&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<dl><dt><a name="BinaryPolynomial-to_terms"><strong>to_terms</strong></a>(a, x='x')<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Convert&nbsp;polynomial&nbsp;a&nbsp;to&nbsp;a&nbsp;string&nbsp;with&nbsp;sum&nbsp;of&nbsp;powers&nbsp;of&nbsp;x.</tt></dd></dl>

<hr>
Data descriptors inherited from <a href="mpyc.gfpx.html#Polynomial">Polynomial</a>:<br>
<dl><dt><strong>value</strong></dt>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Polynomial">class <strong>Polynomial</strong></a>(<a href="https://docs.python.org/3/library/functions.html#object">builtins.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="#Polynomial">Polynomial</a>(value)<br>
&nbsp;<br>
Polynomials&nbsp;over&nbsp;GF(p)&nbsp;represented&nbsp;as&nbsp;lists&nbsp;of&nbsp;integers&nbsp;in&nbsp;{0,&nbsp;...&nbsp;,&nbsp;p-1}.<br>
&nbsp;<br>
Invariant:&nbsp;last&nbsp;element&nbsp;of&nbsp;attribute&nbsp;'value'&nbsp;is&nbsp;a&nbsp;nonzero&nbsp;integer&nbsp;(if&nbsp;'value'&nbsp;nonempty).<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Polynomial-__add__"><strong>__add__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__bool__"><strong>__bool__</strong></a>(self)</dt><dd><tt>Truth&nbsp;value&nbsp;testing.<br>
&nbsp;<br>
Return&nbsp;False&nbsp;if&nbsp;this&nbsp;polynomial&nbsp;is&nbsp;zero,&nbsp;True&nbsp;otherwise.</tt></dd></dl>

<dl><dt><a name="Polynomial-__divmod__"><strong>__divmod__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__eq__"><strong>__eq__</strong></a>(self, other)</dt><dd><tt>Equality&nbsp;test.</tt></dd></dl>

<dl><dt><a name="Polynomial-__floordiv__"><strong>__floordiv__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__ge__"><strong>__ge__</strong></a>(self, other)</dt><dd><tt>Greater-than&nbsp;or&nbsp;equal&nbsp;comparison.</tt></dd></dl>

<dl><dt><a name="Polynomial-__gt__"><strong>__gt__</strong></a>(self, other)</dt><dd><tt>Strictly&nbsp;greater-than&nbsp;comparison.</tt></dd></dl>

<dl><dt><a name="Polynomial-__hash__"><strong>__hash__</strong></a>(self)</dt><dd><tt>Make&nbsp;polynomials&nbsp;hashable&nbsp;(e.g.,&nbsp;for&nbsp;LRU&nbsp;caching).</tt></dd></dl>

<dl><dt><a name="Polynomial-__iadd__"><strong>__iadd__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__ifloordiv__"><strong>__ifloordiv__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__ilshift__"><strong>__ilshift__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__imod__"><strong>__imod__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__imul__"><strong>__imul__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__init__"><strong>__init__</strong></a>(self, value)</dt><dd><tt>Initialize&nbsp;self.&nbsp;&nbsp;See&nbsp;help(type(self))&nbsp;for&nbsp;accurate&nbsp;signature.</tt></dd></dl>

<dl><dt><a name="Polynomial-__int__"><strong>__int__</strong></a>(self)</dt></dl>

<dl><dt><a name="Polynomial-__irshift__"><strong>__irshift__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__isub__"><strong>__isub__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__le__"><strong>__le__</strong></a>(self, other)</dt><dd><tt>Less-than&nbsp;or&nbsp;equal&nbsp;comparison.</tt></dd></dl>

<dl><dt><a name="Polynomial-__lshift__"><strong>__lshift__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__lt__"><strong>__lt__</strong></a>(self, other)</dt><dd><tt>Strictly&nbsp;less-than&nbsp;comparison.</tt></dd></dl>

<dl><dt><a name="Polynomial-__mod__"><strong>__mod__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__mul__"><strong>__mul__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__ne__"><strong>__ne__</strong></a>(self, other)</dt><dd><tt>Negated&nbsp;equality&nbsp;test.</tt></dd></dl>

<dl><dt><a name="Polynomial-__neg__"><strong>__neg__</strong></a>(self)</dt></dl>

<dl><dt><a name="Polynomial-__pos__"><strong>__pos__</strong></a>(self)</dt></dl>

<dl><dt><a name="Polynomial-__pow__"><strong>__pow__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__radd__"><strong>__radd__</strong></a> = <a href="#Polynomial-__add__">__add__</a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__rdivmod__"><strong>__rdivmod__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return&nbsp;repr(self).</tt></dd></dl>

<dl><dt><a name="Polynomial-__rfloordiv__"><strong>__rfloordiv__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__rlshift__"><strong>__rlshift__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__rmod__"><strong>__rmod__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__rmul__"><strong>__rmul__</strong></a> = <a href="#Polynomial-__mul__">__mul__</a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__rrshift__"><strong>__rrshift__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__rshift__"><strong>__rshift__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__rsub__"><strong>__rsub__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-__sub__"><strong>__sub__</strong></a>(self, other)</dt></dl>

<dl><dt><a name="Polynomial-degree"><strong>degree</strong></a>(self)</dt><dd><tt>Degree&nbsp;of&nbsp;polynomial&nbsp;(-1&nbsp;for&nbsp;zero&nbsp;polynomial).</tt></dd></dl>

<dl><dt><a name="Polynomial-to_bytes"><strong>to_bytes</strong></a>(self, length, byteorder)</dt><dd><tt>Return&nbsp;a&nbsp;bytes&nbsp;<a href="https://docs.python.org/3/library/functions.html#object">object</a>&nbsp;representing&nbsp;a&nbsp;polynomial.</tt></dd></dl>

<hr>
Class methods defined here:<br>
<dl><dt><a name="Polynomial-add"><strong>add</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Add&nbsp;polynomials&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Polynomial-deg"><strong>deg</strong></a>(a)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Degree&nbsp;of&nbsp;polynomial&nbsp;a&nbsp;(-1&nbsp;if&nbsp;a&nbsp;is&nbsp;zero&nbsp;polynomial).</tt></dd></dl>

<dl><dt><a name="Polynomial-divmod"><strong>divmod</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Divide&nbsp;polynomial&nbsp;a&nbsp;by&nbsp;polynomial&nbsp;b&nbsp;with&nbsp;remainder,&nbsp;for&nbsp;nonzero&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Polynomial-from_terms"><strong>from_terms</strong></a>(s, x='x')<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Convert&nbsp;string&nbsp;s&nbsp;with&nbsp;sum&nbsp;of&nbsp;powers&nbsp;of&nbsp;x&nbsp;to&nbsp;a&nbsp;polynomial.</tt></dd></dl>

<dl><dt><a name="Polynomial-gcd"><strong>gcd</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Greatest&nbsp;common&nbsp;divisor&nbsp;of&nbsp;polynomials&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Polynomial-gcdext"><strong>gcdext</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="functions.html#type">builtins.type</a></font></font></dt><dd><tt>Extended&nbsp;GCD&nbsp;for&nbsp;polynomials&nbsp;a&nbsp;and&nbsp;b.<br>
&nbsp;<br>
Return&nbsp;d,&nbsp;s,&nbsp;t&nbsp;satisfying&nbsp;s&nbsp;a&nbsp;+&nbsp;t&nbsp;b&nbsp;=&nbsp;d&nbsp;=&nbsp;<a href="#Polynomial-gcd">gcd</a>(a,b).</tt></dd></dl>

<dl><dt><a name="Polynomial-invert"><strong>invert</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Inverse&nbsp;of&nbsp;polynomial&nbsp;a&nbsp;modulo&nbsp;polynomial&nbsp;b,&nbsp;for&nbsp;nonzero&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Polynomial-is_irreducible"><strong>is_irreducible</strong></a>(a)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Test&nbsp;polynomial&nbsp;a&nbsp;for&nbsp;irreducibility.</tt></dd></dl>

<dl><dt><a name="Polynomial-lshift"><strong>lshift</strong></a>(a, n)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Multiply&nbsp;polynomial&nbsp;a&nbsp;by&nbsp;X^n.</tt></dd></dl>

<dl><dt><a name="Polynomial-mod"><strong>mod</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Reduce&nbsp;polynomial&nbsp;a&nbsp;modulo&nbsp;polynomial&nbsp;b,&nbsp;for&nbsp;nonzero&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Polynomial-mul"><strong>mul</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Multiply&nbsp;polynomials&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Polynomial-next_irreducible"><strong>next_irreducible</strong></a>(a)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Return&nbsp;lexicographically&nbsp;next&nbsp;monic&nbsp;irreducible&nbsp;polynomial&nbsp;&gt;&nbsp;a.<br>
&nbsp;<br>
E.g.,&nbsp;X&nbsp;&lt;&nbsp;X+1&nbsp;&lt;&nbsp;X^2+X+1&nbsp;&lt;&nbsp;X^3+X+1&nbsp;&lt;&nbsp;X^3+X^2+1&nbsp;&lt;&nbsp;...&nbsp;for&nbsp;p=2.</tt></dd></dl>

<dl><dt><a name="Polynomial-powmod"><strong>powmod</strong></a>(a, n, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt><a href="#Polynomial">Polynomial</a>&nbsp;a&nbsp;to&nbsp;the&nbsp;power&nbsp;of&nbsp;n&nbsp;modulo&nbsp;polynomial&nbsp;b,&nbsp;for&nbsp;nonzero&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Polynomial-rshift"><strong>rshift</strong></a>(a, n)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Quotient&nbsp;for&nbsp;polynomial&nbsp;a&nbsp;divided&nbsp;by&nbsp;X^n,&nbsp;assuming&nbsp;a&nbsp;is&nbsp;multiple&nbsp;of&nbsp;X^n.</tt></dd></dl>

<dl><dt><a name="Polynomial-sub"><strong>sub</strong></a>(a, b)<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Subtract&nbsp;polynomials&nbsp;a&nbsp;and&nbsp;b.</tt></dd></dl>

<dl><dt><a name="Polynomial-to_terms"><strong>to_terms</strong></a>(a, x='x')<font color="#909090"><font face="helvetica, arial"> from <a href="https://docs.python.org/3/library/functions.html#type">builtins.type</a></font></font></dt><dd><tt>Convert&nbsp;polynomial&nbsp;a&nbsp;to&nbsp;a&nbsp;string&nbsp;with&nbsp;sum&nbsp;of&nbsp;powers&nbsp;of&nbsp;x.</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>value</strong></dt>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>p</strong> = None</dl>

</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-GFpX"><strong>GFpX</strong></a>(p)</dt><dd><tt>Create&nbsp;type&nbsp;for&nbsp;polynomials&nbsp;over&nbsp;GF(p).</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>X</strong> = 'x'</td></tr></table>
</body></html>